#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
using PDD = pair<double, double>;
int n, d;
vector<PDD> a;
bool stt[2020];
int main()
{
    bool have_ans = true;
    int my = 0;
    cin >> n >> d;
    for(int i = 0; i < n; ++i)
    {
        int x, y;
        cin >> x >> y;
        if(y > d)
            have_ans = false;
        else
        {
            auto l = sqrt(d * d - y * y);
            a.push_back({x - l, x + l});
        }
    }
    if(!have_ans)
        cout << -1 << endl;
    else
    {
        int num = 0;
        sort(a.begin(), a.end(), [](PDD& a, PDD& b){
            return a.second < b.second;
        });
        double last = -0x3f3f3f3f;
        for(int i = 0; i < n; ++i)
        {
            auto [st, ed] = a[i];
            if(st > last + 1e-8)
                last = ed, num++;
            
        }
        
        cout << num << endl;
    }
    return 0;
}